package MANA;

/**
 * Class that represents the player.
 * @author daan :-)
 *
 */
public class Player extends Actor {
    private static int currentLvl = 0;
    private static int lastLvl = 0;
    
    /**
     * Creates a new player at x, y
     * @param x x pos
     * @param y y pos
     */
    public Player(int x, int y) {
        super(x, y);
        loadImage("res/player.png");
    }
    
    /**
     * Get the current depth of the player
     * @return returns the current depth
     */
    public int getCurrentlvl() {
    	return currentLvl;
    }
    
    /**
     * 
     * @return returns the level the player was on before he was on this level
     */
    public int getLastlvl() {
    	return lastLvl;
    }
    
    /**
     * Decreases the current depth of the player</br>
     * Call if the player goes down
     */
    public void decreaseLvl() {
    	lastLvl = currentLvl;
    	currentLvl = currentLvl - 1;
    	return;
    }
    /**
     * Increases the current depth of the player
     * Call if the player goes up
     */
    public void increaseLvl() {
    	if (currentLvl > -1) {
    		return;
    	} else {
    		lastLvl = currentLvl;
    		currentLvl = currentLvl + 1;
    		return;
    	}
    }
    /**
     * Checks whether the player is on stairs stairs
     * @param stairs stairs to check
     * @return returns true if the player is on stairs
     */
    public boolean isOnStairs(Stairs stairs) {
        if (((this.x()) == stairs.x()) &&
                (this.y() == stairs.y())) {
                return true;
            } else {
                return false;
            }
    }
    /**
     * Move the player from one place to another
     * @param x x to change the current x with
     * @param y y to change the current y with
     */
    public void move(int x, int y) {
        int nx = this.x() + x;
        int ny = this.y() + y;
        this.setX(nx);
        this.setY(ny);
    }
}
